home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Over 1,000 Windows 95 Programs
/
Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso
/
1249
/
invert2.t
< prev
next >
Wrap
Text File
|
1997-04-18
|
771b
|
45 lines
%
% "invert2" inverts a two by two matrix
%
% Sample program for the T Interpreter by:
%
% Stephen R. Schmitt
% 962 Depot Road
% Boxborough, MA 01719
%
const DIM : int := 2
program
var x, y, z : rmatrix
var det : real
label program_exit :
x[0,0] := 6.0 % matrix to invert
x[0,1] := 3.0
x[1,0] := 2.0
x[1,1] := 4.0
put "matrix X:"
print_mat( x )
det := invert( x, y, true )
if det = 0.0 then
put "is singular"
goto program_exit
end if
put "determinant of X = ", det
put "the inverse of X is:"
print_mat( y )
put "check result:"
mul_mat_mat( x, y, z )
print_mat( z )
program_exit:
end program